<script type="text/javascript">
$(document).ready(function(){
	parent.showButton("save,back");
});
function doButton(btn){
	if(btn == 'save'){
    	$.post("__URL__/index_act/act/{$act}/", $("#form").serialize(),function(data){
			eval("var dataJ = " + data);
			if(dataJ.success == 1){
				alert("编辑成功");
				location.href="__URL__/index";
			}else if(dataJ.message !=''){
				alert(dataJ.message);
			}else{
				alert("编辑失败");
			}
		});
	}else if(btn == "back"){
        location.href = "__URL__/index/";
	}
}
</script>
  <div class="data-list">
	    <form action="__URL__/index_act/act/{$act}/" method="post" enctype="multipart/form-data" id="form">
		  <if condition="$_GET['act'] eq 'edit'">
          	<div style="font-weight:bold;font-size:16px;padding:12px;">权限名称：{$info['name']}</div>
          <else/>
          	<div style="font-weight:bold;font-size:16px;padding:12px;"><span class="required">*</span>权限名称：<input type="text" name="name" value=""></div>
          </if>
          <input type="hidden" name="id" id="id" value="{$info['id']}" />
          <input type="hidden" name="act" id="act" value="{$_GET['act']}" />
	      <table class="list">
	        <tbody>
	        <volist name="Rights" id="val" key="key1">
	        <php>
	        	if($info['rights'][$key][sel] == 1){
	        		$check = "checked";
	        	}else{
	        		$check = "";
	        	}
	        </php>
	          <tr style="background-color: rgb(244, 244, 248);">
	            <td class="left"><label><input type="checkbox" value="1" name="item[{$key}][sel]" {$check}>{$val.name}</label></td>
	          </tr>
	          <php>
	          	$item_key = $key;
	          </php>
	        	<volist name="val.items" id="val2" key="key2">
		          <php>
		        	if($info['rights'][$item_key][$val2[key]][sel] == 1){
		        		$check_2 = "checked";
		        	}else{
		        		$check_2 = "";
		        	}
		          </php>
		          <tr style="background-color: white;">
		            <td class="left" style="padding-left:20px;">
		            	<label><input type="checkbox" value="1" name="item[{$item_key}][{$val2.key}][sel]" {$check_2}>{$val2.name}</label>&nbsp; &nbsp; &nbsp; 
		            		<volist name="val2.list" id="val3" key="key3">
					          <php>
					        	if($info['rights'][$item_key][$val2[key]][$key][sel] == 1){
					        		$check_3 = "checked";
					        	}else{
					        		$check_3 = "";
					        	}
					          </php>
		            			<label><input type="checkbox" value="1" name="item[{$item_key}][{$val2.key}][{$key}][sel]" {$check_3}>{$val3}</label>&nbsp; 
		            		</volist>
		            	</td>
		          </tr>
	        	</volist>
	        </volist>
	        </tbody>
	      </table>
		</form>
		</div>